#include<unistd.h>
#include<sys/types.h>
#include<stdio.h>
#include<iostream>
using namespace std;

int main()
{

  int pid=fork();
  if(pid<0)
  {
   cout<<"fork fail"<<endl;


  }
  else if(pid==0)
  {int cnt=5;
   while(cnt--)
   {
     cout<<"i am child process"<<"pid:"<<getpid()<<"ppid:"<<getppid()<<endl;
     sleep(1);


   }




  }

  else
  {

   while(1)
   {

    cout<<"i am father process"<<"pid:"<<getpid()<<"ppid:"<<getppid()<<endl;
    sleep(1);

   }





  }










}